﻿using System;
using System.Drawing;
using System.Windows.Forms;

namespace DCIMAP.GANS.GeneticAlgorithms.Legacy
{
    /// <summary>
    /// Panel for representation of IQ task
    /// </summary>
    public class IQOutputPanel : TextBox, IGeneticAlgorithmOutputControl
    {
        private readonly int[] sequence;

        /// <summary>
        /// Передаем последовательность
        /// </summary>
        public IQOutputPanel(int[] sequence)
        {
            this.sequence = sequence;
            ReadOnly = true;
            Multiline = true;
            BackColor = Color.White;
            ScrollBars = ScrollBars.Vertical;
            Font = new Font("Times New Roman", 13);
        }


        /// <inheritdoc/>
        public void Draw(Gene g)
        {
            string st1 = "";
            string st2 = "";

            for (int i = 0; i < sequence.Length; ++i)
                st1 += sequence[i].ToString()+",";

            StringArrayGene ar = (StringArrayGene)g;

            /*for (int i = 0; i < ar.Code.Length; i++)
                st2 += ar.StringCode[i];
            */
            st2 = ar.prettyPrint();
           
            Text = "Sequence: " + st1 + "\r\n\r\nFunction: f = " + st2;
        }

    }
}